package com.example.lol.ui;

import android.annotation.SuppressLint;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;

import com.example.demo.R;
import com.example.demo.day1.SettingActivity;
import com.example.lol.adapter.ListAdapter;
import com.example.lol.bean.ListBean;
import com.google.android.material.bottomnavigation.BottomNavigationView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.FragmentActivity;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class LolMainActivity extends FragmentActivity {


    private RecyclerView recyclerView;
    private ListAdapter LA;
    //绑定数据
    ListBean LB;
    private List<ListBean> data = new ArrayList<>();


    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.view_lol_main);
        Log.e("onCreate: ", "kkkk");

        // <editor-fold defaultstate="collapsed" desc="右滑recycle的适配器设置">
        LA = new ListAdapter();
        recyclerView = (RecyclerView) findViewById(R.id.list1);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setAdapter(LA);
        // </editor-fold>
        // <editor-fold defaultstate="collapsed" desc="这里是底部导航栏的设置">
        BottomNavigationView navView = findViewById(R.id.nav_view1);
        // Passing each menu ID as a set of Ids because each
        // menu should be considered as top level destinations.
        AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
                R.id.tab_circle, R.id.tab_friend, R.id.tab_store, R.id.tab_news, R.id.tab_user_center)
                .build();
        NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
//        setupWithNavController = navView.setupWithNavController(navController);
//        NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
        NavigationUI.setupWithNavController(navView, navController);
        // </editor-fold>
        // <editor-fold defaultstate="collapsed" desc="这里是右滑recycleview绑定数据">

        LB = new ListBean("我的评论", R.drawable.ic_list1);
        data.add(LB);
        LB = new ListBean("与我相关", R.drawable.ic_list2);
        data.add(LB);
        LB = new ListBean("我的订单", R.drawable.ic_list3);
        data.add(LB);
        LB = new ListBean("我的任务", R.drawable.ic_list4);
        data.add(LB);
        LB = new ListBean("我的收藏", R.drawable.ic_list5);
        data.add(LB);
        LB = new ListBean("活动中心", R.drawable.ic_list6);
        data.add(LB);
        LB = new ListBean("信用分", R.drawable.ic_list7);
        data.add(LB);
        LA.addData(data);
        Log.e("bindData: ", "" + data.size());
// </editor-fold>
        // <editor-fold defaultstate="collapsed" desc="这里是设置界面跳转的绑定">
        findViewById(R.id.tv_setting_btn).setOnClickListener(new View.OnClickListener() {
            @SuppressLint("WrongConstant")
            @Override
            public void onClick(View view) {
                startActivity(new Intent(LolMainActivity.this, SettingActivity.class));
            }
        });
// </editor-fold>

    }






}